
const Controller = require('egg').Controller;
const md5 = require('md5')
class Initial extends Controller {
  async index() {
    await this.app.model.Project.create({
        project_name:"青龙职教中心",project_site:"青龙县青龙职教中心",project_sketch:"国家重点项目",project_state:1,
    })
    await this.app.model.Project.create({
        project_name:"山海关铁路技师学院",project_site:"秦皇岛市山海关区工人新村863号",project_sketch:"国家重点项目",project_state:1,
    })
    await this.app.model.Project.create({
        project_name:"安新职教中心",project_site:"安新职教中心",project_sketch:"安新职教中心",project_state:1,
    })
    await this.app.model.Menu.create({
        name:"超级管理员",user:1,role:1,test:1,project:1,class:1,student_inquire:1,
        score_inquire:1,thousand_inquire:1,award:1,score_grouping:1,thousand_rule:1,show_works:1,
        show_grouping:1,course:1,menu_menu:1,cc:1,log_list:1,thousand_audit:1,information_list:1
    })
    await this.app.model.Menu.create({
        name:"管理员",user:1,role:1,test:0,project:0,class:1,student_inquire:1,
        score_inquire:0,thousand_inquire:0,award:1,score_grouping:0,thousand_rule:0,show_works:1,
        show_grouping:0,course:1,menu_menu:0,cc:0,log_list:1,thousand_audit:1,information_list:1
    })
    await this.app.model.Menu.create({
        name:"教员",user:0,role:0,test:0,project:1,class:1,student_inquire:1,
        score_inquire:1,thousand_inquire:0,award:0,score_grouping:1,thousand_rule:0,show_works:1,
        show_grouping:1,course:0,menu_menu:0,cc:0,log_list:0,thousand_audit:0,information_list:1
    })
    await this.app.model.Menu.create({
        name:"班主任",user:0,role:0,test:0,project:0,class:1,student_inquire:1,
        score_inquire:0,thousand_inquire:1,award:0,score_grouping:0,thousand_rule:1,show_works:1,
        show_grouping:0,course:0,menu_menu:0,cc:0,log_list:0,thousand_audit:1,information_list:1
    })
    await this.app.model.Menu.create({
        name:"教官",user:0,role:0,test:0,project:0,class:0,student_inquire:1,
        score_inquire:1,thousand_inquire:1,award:1,score_grouping:1,thousand_rule:1,show_works:1,
        show_grouping:1,course:1,menu_menu:0,cc:0,log_list:0,thousand_audit:0,information_list:1
    })
    await this.app.model.User.create({
        username:'root',type:'超级管理员',password:md5('123456'),name:"匿名",sex:1,email:'123456@126.com',
        phone:13888888,project:"青龙职教中心",class:'1804,1805,1904,1903',state:'1'
    })
       
    this.ctx.body = await this.ctx.model.User.findAll({}) 
  }

}

module.exports = Initial;
